package com.hui.service;

import com.hui.dao.CategoryDao;
import com.hui.entity.Category;
import com.hui.mapper.CategoryMapper;
import com.hui.util.DruidUtil;

import java.util.List;

/**
 * @Description 分类(Category)业务层
 * @date 2023/2/10 19:50
 */
public class CategoryService {

    /**
     * 获取分类的全部数据
     **/
    public List<Category> findCategoryAll() {
        CategoryDao dao = new CategoryDao();
        List<Category> categoryAll = dao.findCategoryAll();
        return categoryAll;
    }

    /**
     * 添加分类数据
     **/
    public void insertCategory(Category category) {
        CategoryDao dao = new CategoryDao();
        dao.insertCategory(category);
    }

    /**
     * 根据分类的Id修改分类数据
     **/
    public void updateCategoryById(Category category) {
        CategoryDao dao = new CategoryDao();
        dao.updateCategoryById(category);
    }

    /**
     * 根据Id查询分类的数据
     **/
    public Category findCategoryById(int categoryId) {
        CategoryDao dao = new CategoryDao();
        return dao.findCategoryById(categoryId);
    }

    /**
     * 根据Id删除分类的数据
     **/
    public void delCategoryById(int categoryId) {
        CategoryDao dao = new CategoryDao();
        dao.delCategoryById(categoryId);
    }

}
